#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<unordered_set>
using namespace std;
struct ListNode {
    int val;
    struct ListNode *next;
    ListNode(int x) :
        val(x), next(NULL) {
    }
};

class Solution {
public:
    ListNode* EntryNodeOfLoop(ListNode* pHead) {
        unordered_set<ListNode*> hash;
        while (pHead)
        {
            if (hash.count(pHead))
                return pHead;
            hash.insert(pHead);
            pHead = pHead->next;
        }
        return nullptr;
    }
};
int main()
{
    return 0;
}